
using System.Windows.Controls;
using System.Windows.Data;

namespace Red.Controls.DataDriven
{
    /// <summary>
    ///     Data-aware text box
    /// </summary>
    [InteropControl( "String", "StringAnsi", "CDateTime", "CName" )]
    public class DataTextBox : TextBox
    {
        public DataTextBox()
        {
            SetBinding( TextProperty, new Binding( "Value" ) { 
                Mode = BindingMode.TwoWay, 
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged 
            } );

            SetBinding( IsReadOnlyProperty, new Binding( "IsReadOnly" )
            {
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            } );
        }
    }
}
